package com.mida.dms.knw.api;

import com.mida.dms.knw.entity.KnwConceptualDomain;
import com.mida.dms.knw.entity.KnwSlot;
import com.mida.dms.knw.entity.vo.KnwSlotVo;
import com.mida.dms.knw.entity.vo.MapperPage;
import com.mida.dms.knw.vo.KnwSlotPageVo;
import com.mida.dms.knw.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <h1>本体slot对外服务</h1>
 * <p>
 *
 * </p>
 *
 * @author jian.li on 2021/6/22 10:48
 */
@DependsOn("loadFromDatabasePropertyConfig")
@FeignClient(name = "KnwSlotApi", url = "dms.knw.feign.url")
//@FeignClient(name = "KnwSlotApi", url = "${dms.knw.feign.url}")
public interface KnwSlotApi {

    @ApiModelProperty(value = "更新slot对应编码体系(发布状态)", notes = "更新slot对应编码体系(发布状态)")
    @GetMapping(value = "/knwNoumenon/updateDetailCoding", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult updateDetailCoding(@RequestParam(value = "slotSoid") Long slotSoid,
                                    @RequestParam(value = "detailCodingSystemSoid",required = false) Long detailCodingSystemSoid);

    @ApiOperation(value = "发布本体", notes = "发布本体")
    @PostMapping(value = "/knwNoumenon/publish", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult publish(@RequestParam(value = "noumenonSoid") Long noumenonSoid,
                         @RequestBody List<KnwSlot> list);

    /**
     * 新增slot(本体是草稿状态)
     */
    @ApiOperation(value = "新增slot", notes = "新增slot")
    @PostMapping(value = "/knwNoumenon/addSlot", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult add(@RequestBody KnwSlotVo vo);


    /**
     * 分页查询
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping(value = "/knwNoumenon/selectSlot", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<PageResultVo<KnwSlotVo>> findPage(@RequestBody KnwSlotPageVo vo);

    /**
     * 根据本体soid查询所有本体Slot
     */
    @ApiOperation(value = "查询所有本体Slot", notes = "查询所有本体Slot")
    @GetMapping(value = "/knwNoumenon/findAllSlot")
    @ResponseBody
    ListResult<List<KnwSlotVo>> findAllSoltBynoumenonSoid(@RequestParam(value = "noumenonSoid") Long noumenonSoid);

    @ApiOperation(value = "根据slotsoid查询一条slot信息", notes = "根据slotsoid查询一条slot信息")
    @GetMapping(value = "/knwNoumenon/selectSlotBySoid", produces = {"application/json;charset=UTF-8"})
    ListResult<KnwSlotVo> findBySlotSoid(@RequestParam(value = "soid") Long soid);

    /**
     * slot排序
     */
    @ApiOperation(value = "slot排序", notes = "slot排序")
    @PutMapping(value = "/knwNoumenon/orderSlot", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult order(@RequestParam("originalSlotOrder") Long originalSlotOrder,
                       @RequestParam("newSlotOrder") Long newSlotOrder,
                       @RequestParam("slotSoid") Long slotSoid);

    /**
     * 更新slot
     */
    @ApiOperation(value = "更新slot", notes = "更新slot")
    @PostMapping(value = "/knwNoumenon/updateSlot", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<Object> update(@RequestBody KnwSlotVo vo);

    /**
     * 删除slot
     */
    @ApiOperation(value = "删除slot", notes = "删除slot")
    @PostMapping(value = "/knwNoumenon/deleteSlot", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult delete(@RequestBody KnwSlotVo vo);

    /**
     * Slot简码查询
     */
    @ApiOperation(value = "Slot简码查询", notes = "Slot简码查询")
    @PostMapping(value = "/knwNoumenon/selectSlotNameByCode", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<Object> selectSlotNameByCode(@RequestBody MapperPage vo);

    /**
     * 选中Slot名称后加载定义域
     */
    @ApiOperation(value = "选中Slot名称后加载定义域", notes = "选中Slot名称后加载定义域")
    @PostMapping(value = "/knwNoumenon/getDataBySlotName", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<Object> getDataBySlotName(@RequestBody KnwSlotVo vo);

    /**
     * 根据定义域id获取编码体系
     */
    @ApiOperation(value = "根据定义域id获取编码体系", notes = "根据定义域id获取编码体系")
    @PostMapping(value = "/knwNoumenon/getDataByDomainId", consumes = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<Object> getDataByDomainId(@RequestBody KnwConceptualDomain domain);
}
